<?php
$p = $this->params;

$mainMenu = array(
	'Kurse' => array(
		'controller'=>'courses',
		'action'=>'index'	
	),
	'Studenten' => array(
		'controller'=>'students',
		'action'=>'index'	
	),
	'Unternehmen' => array(
		'controller'=>'companies',
		'action'=>'index'	
	),
	'Ansprechpartner' => array(
		'controller'=>'contactPersons',
		'action'=>'index'	
	),
	'Meldungen' => array(
		'controller'=>'notices',
		'action'=>'index'	
	),
	'Dozenten' => array(
		'controller'=>'professors',
		'action'=>'index'	
	),
	'Profile' => array(
		'controller'=>'profiles',
		'action'=>'index'	
	),
	'Studienrichtung' => array(
		'controller'=>'studyBranches',
		'action'=>'index'	
	),
	'Kurs Spezialisierung' => array(
		'controller'=>'courseSpecialisations',
		'action'=>'index'	
	),
	'User' => array(
		'controller'=>'users',
		'action'=>'index'	
	),
	'Rollen' => array(
		'controller'=>'roles',
		'action'=>'index'	
	)
	
);

$submenu = array(
	'roles' => array(
		'Rollen verwalten' => array(
			'methods'=> array('index'),
			'controller'=> 'roles',
			'action'=>'index'
		),
		'Rolle anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'roles',
			'action'=>'add'
		)
	),
	'courses' => array(
		'Kurse verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'courses',
			'action'=>'index'
		),
		'Kurs anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'courses',
			'action'=>'add'
		)
	),
	'profiles' => array(
		'Profile verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'profiles',
			'action'=>'index'
		),
		'Profil anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'profiles',
			'action'=>'add'
		)
	),
	'studyBranches' => array(
		'Studienrichtungen verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'studyBranches',
			'action'=>'index'
		),
		'Studienrichtung anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'studyBranches',
			'action'=>'add'
		)
	),
	'courseSpecialisations' => array(
		'Kurs Spezialisierungen verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'courseSpecialisations',
			'action'=>'index'
		),
		'Kurs Spezialisierungen anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'courseSpecialisations',
			'action'=>'add'
		)
	),
	'students' => array(
		'Studenten verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'students',
			'action'=>'index'
		),
		'Student anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'students',
			'action'=>'add'
		)
	),
	'companies' => array(
		'Unternehmen verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'companies',
			'action'=>'index'
		),
		'Unternehmen anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'companies',
			'action'=>'add'
		)
	),
	'notices' => array(
		'Meldungen verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'notices',
			'action'=>'index'
		),
		'Meldung anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'notices',
			'action'=>'add'
		)
	),
	'professors' => array(
		'Dozenten verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'professors',
			'action'=>'index'
		),
		'Dozent anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'professors',
			'action'=>'add'
		)
	),
	'contactPersons' => array(
		'Ansprechpartner verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'contactPersons',
			'action'=>'index'
		),
		'Ansprechpartner anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'contactPersons',
			'action'=>'add'
		)
	),
	'users' => array(
		'User verwalten' => array(
			'methods'=> array('index','update'),
			'controller'=> 'users',
			'action'=>'index'
		),
		'User anlegen' => array(
			'methods'=> array('add'),
			'controller'=> 'users',
			'action'=>'add'
		)
	)
);
?>

<div id="main_menu">
	<?php 
		foreach($mainMenu as $key => $value){
			$class = 'no-active-menu';
			if($value['controller'] == $p['controller']){
				$class = 'active-menu';
			}
			$out  = '<div class="'.$class.'">';
			$out .= $this->Html->link($key,array('controller'=>$value['controller'],'action'=>$value['action']));
			$out .= '</div>';
			
			if(false){
				
			}else{
				echo $out;
			}
		}
	?>
</div>

<div class="clear"></div>

<div id="sub_menu">
	<?php 
	if(isset($submenu[$p['controller']])){
		foreach ($submenu[$p['controller']] as $key => $value){
			$class = 'active-menu';
			if(in_array($p['action'], $value['methods'])){
				$class = 'active-sub-menu';
			}
			$out = '
				<div class="'.$class.'">
				'.$this->Html->link($key,array('controller'=>$value['controller'],'action'=>$value['action'])).'
				</div>
			';
			echo $out;
		}
	}
	?>
</div>
<div id="border_menu"></div>